<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page isELIgnored="false"%>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">
    <title>博客</title>
    <link href="<%=basePath%>bootstrap/css/blog-home.css"/>
    <link href="<%=basePath%>bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <script src="<%=basePath%>bootstrap/js/jquery-2.1.1.js"></script>
</head>
<body>
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation"><!--导航条、反色、固定在顶部 -->
    <div class="container"><!--将导航条居中对齐并在两侧添加内补 -->
        <div class="navbar-header">
            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="#">博客</a><!--设置了内补（padding）和高度（height） -->
        </div>
        <!--导航链接，表格，和切换其他内容-->
        <div class="collapse navbar-collapse"><!--依赖collapse插件、视口足够窄.navbar-collapse内所包含的内容也将不可见-->
            <ul class="nav navbar-nav"><!--导航、导航项-->
                <li><a href="<%=path%>/user?method=index">网站首页</a></li>
            </ul>
            <c:if test="${null!=user&&user.getIsApplied() == 1}">
                <ul class="nav navbar-nav">
                    <li><a href="<%=basePath%>user?method=myblog&userId=${user.id}">我的博客</a></li>
                    <li><a href="<%=basePath%>article?method=manage&userId=${user.id}"><i class="glyphicon glyphicon-cog"></i> 博文管理</a></li><!--Glyphicons字体图标-->
                    <li class="divider"></li><!--分割线-->
                    <li><a href="<%=basePath%>category?method=manage&userId=${user.id}"><i class="glyphicon glyphicon-cog"></i> 分类管理</a></li><!--Glyphicons字体图标-->
                    <li class="divider"></li>
                    <li><a href="<%=basePath%>comment?method=manage&userId=${user.id}"><i class="glyphicon glyphicon-cog"></i> 评论管理</a></li>
                </ul>
            </c:if>
            <c:if test="${user==null}">
                <ul class="nav navbar-nav navbar-right">
                    <li><a href="<%=path%>/login.jsp" target="_self">登录</a></li>
                    <li><a href="<%=path%>/register.jsp" target="_self">注册</a></li>
                </ul>
            </c:if>
            <c:if test="${user!=null}">
                <div class="pull-right">
                    <ul class="nav navbar-nav navbar-right">
                        <li><a href="#">欢迎，${user.userName}</a></li>
                        <li><a href="<%=basePath%>user?method=profile&id=${user.id}"><i class="glyphicon glyphicon-cog"></i> 编辑个人信息</a></li>
                        <c:if test="${user.isApplied==1}">
                            <li><a href="<%=basePath%>user?method=bloginfo&userId=${user.id}"><i class="glyphicon glyphicon-cog"></i> 编辑博客信息</a></li>
                        </c:if>
                        <li><a href="<%=path%>/user?method=logout"><i class="glyphicon glyphicon-off"></i> 登出</a></li>
                    </ul>
                    </li>
                    </ul>
                </div>
            </c:if>
        </div>
    </div>
</nav>
<div class="container" style="position: absolute;top: 60px;left: 340px">
    <div class="row">
        <div class="col-md-8">
            <!-- blog entry -->
            <h1><a href="<%=basePath%>user?method=myblog&userId=${user.id}">
                <c:if test="${null != blogName}">
                    ${blogName}
                </c:if>
                <c:if test="${null == blogName}">
                    读取博客标题失败！
                </c:if>
            </a></h1>
            <p class="lead">
                <c:if test="${null != bi}">
                    ${bi.description}
                </c:if>
                <c:if test="${null == bi}">
                    读取博客副标题失败！
                </c:if>
            </p><br>
            <c:if test="${null != artList}">
                <c:forEach items="${artList}" var="art">
                    <c:if test="${0 == art.isDelete}">
                        <h3><a href="<%=basePath%>comment?method=post&artId=${art.id}&userId=${user.id}">${art.title}</a></h3>
                        <p>
                            <i class="glyphicon glyphicon-user"></i> <a href="<%=basePath%>user?method=myblog&userId=${art.userId}" target="_self"> ${author}</a>
                            | <i class="glyphicon glyphicon-calendar"></i> ${art.publishTime}
                            | 阅读 ${art.count} 次
                        </p>
                        <hr>
                        <p>${art.summary}</p>
                        <a class="btn btn-primary" href="<%=basePath%>comment?method=post&artId=${art.id}&userId=${user.id}">阅读详细 <span class="glyphicon glyphicon-chevron-right"></span></a>
                        <hr>
                    </c:if>
                </c:forEach>
            </c:if>
            <c:if test="${null == artList}">
                <p>还没有写过文章哦，赶紧写吧~</p>
            </c:if>
            <!-- pager -->
            <ul class="pager">
                <c:if test="${curPage > 1}">
                    <li class="previous"><a href="<%=basePath%>user?method=myblog&curPage=${curPage-1}&userId=${user.id}">&larr; 上一页</a></li>
                </c:if>
                <c:if test="${curPage < totalPages-1}">
                    <li class="next"><a href="<%=basePath%>user?method=myblog&curPage=${curPage+1}&userId=${user.id}">下一页  &rarr;</a></li>
                </c:if>
            </ul>
        </div>

        <div class="col-md-4">
            <form action="servlet/GetSysCategoryServlet" method="GET">
                <div class="well">
                    <h4> 个人文章分类</h4>
                    <div class="row">
                        <div class="col-md-6">
                            <ul class="list-unstyled">
                                <c:if test="${null != cgList}">
                                    <c:forEach items="${cgList}" var="cg">
                                        <c:if test="${cg.isDelete== 0}">
                                            <li><a href="<%=basePath%>user?method=myblogFilter&userId=${user.id}&categoryId=${cg.id}">${cg.categoryName}</a></li>
                                        </c:if>
                                    </c:forEach>
                                </c:if>
                                <c:if test="${null != cgList}">
                                    <li>无分类</li>
                                </c:if>
                            </ul>
                        </div>
                    </div>
                </div><!-- /well -->
            </form>

            <div class="well">
                <h4>公告</h4>
                <p>${bi.propagate}</p>
            </div><!-- /well -->
        </div>
    </div>
</div><!-- /.container -->
<div class="container" style="position: absolute;bottom: 10px;left: 360px">
    <hr>
    <footer style="text-align: center">
        <div class="row">
            <div class="col-lg-12">
                <p>
                    &middot;网站创建到目前访问人数：<%=(Integer)session.getAttribute("num") %>
                </p>
            </div>
        </div>
    </footer>
</div>
</div>
<div><audio autoplay="autoplay" loop="true"><source src="music/1.mp3"></audio></div>
</body>
</html>